/**
 * 
 */


/* 刷新新闻列表  */
function refreshNewsListUL(path,page){
	$("#news_list_ul li").remove();
	 
	$.ajax({  
		type : "POST", 
		url : path+"/newsAction_list.action",
		data:{
			title:$("#common_right_search_input").val(),
			page:page
		},
		dataType : 'json', 
		success : function(result) { 
			initNewsPage(path,page,result.pageBean.totalPages);  
			var data=result.data;
			for(var i=0;i<data.length;i++){   
				var $e=$('<li><h4 ><img style="width:15px;height:15px;" src="../images/index/xinwen.png" ></img> &nbsp; <a href="newsAction_getById.action?id='+data[i].uuid+'">'+data[i].title+'<small> -- '+data[i].newsTime+'</small></a></h4><div class="blog_list_shortcontent">'+data[i].summary+'</div></li>');
				$('#news_list_ul').append($e);
			}
		} 
	});
}

/**
 * 初始化分页插件 
 * @param curPage
 * @param totalPages 
 */
function initNewsPage(path,curPage,totalPages){
	

	if(totalPages==0){
		totalPages=1;  
	}
	
	var options = {
			currentPage : curPage,
			totalPages : totalPages,
			numberOfPages : 5,  
			size:"normal",
			alignment:"right",  
			/*pageUrl : function(type, page, current) { 
				return path + "/blog_blogList.action?rows=10&page=" + page;
			}*/
			onPageClicked: function(e,originalEvent,type,page){
				refreshNewsListUL(path,page);
            }
		}
		$('#page1').bootstrapPaginator(options);
}